<template>
  <PageContainer>
    <template>
      <BaseHeader ref="baseHeader" v-model:headerHeight="headerHeight" />
      <view>
        <TopButton :header-height="headerHeight" />
        <Content />
      </view>
      <Tabbar path="home" />
      <Guide v-if="getHomeGuideVisible" :steps-number="4" :type="GuideType.HOME" />
    </template>
  </PageContainer>
</template>

<script lang="ts" setup>
  /* home 首页 */
  import Tabbar from '../components/Tabbar.vue';
  import BaseHeader from '../components/BaseHeader.vue';
  import TopButton from '../components/TopButton.vue';
  import Content from './components/Content.vue';
  import { useUserStore } from '@/store/modules/user';
  import { CacheEnum } from '@/enums/CacheEnum';
  import { GuideType } from '@/store/modules/guide';

  const getHomeGuideVisible = computed(() => {
    const { userInfo } = useUserStore();
    const cacheVisible = uni.getStorageSync(CacheEnum.HOME_GUIDE_VISIBLE);
    if (userInfo?.aiUserAccountBotVo && !cacheVisible) {
      uni.setStorageSync(CacheEnum.HOME_GUIDE_VISIBLE, true);
      return true;
    }
    return false;
  });

  const headerHeight = ref(44);
  uni.hideShareMenu({
    hideShareItems: ['shareAppMessage', 'shareTimeline'],
  });

  customOnload(() => {
    console.log('customOnload');
  });

  onShareAppMessage(() => ({}));
</script>

<style lang="scss" scoped></style>
